package com.yxw.bamboo.api.dao;

import com.yxw.bamboo.core.database.sql.Host;
import com.yxw.bamboo.core.database.sql.MockData;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MockDataMapper {
    @Select("select b.id as id,intercept_sql, a.sql_type," +
            "       a.host_status," +
            "       a.local_port," +
            "       a.remote_host_addr," +
            "       a.remote_host_port," +
            "       a.ssl," +
            "       a.local_host_addr," +
            "       b.db_name," +
            "       b.user_name," +
            " b.replace_sql," +
            "b.is_removed" +
            " from InterceptRule as b join host as a on b.host_id=a.id where b.is_removed=0 and b.id>#{id}")
    @Results(value = {
            @Result(id=true,column = "id",property = "id"),
            @Result(id=false,column = "sll",property = "sll"),
            @Result(id=false,column = "db_name",property = "dbName"),
            @Result(id=false,column = "user_name",property = "userName"),
            @Result(id=false,column = "sql_type",property = "mockType"),
            @Result(id=false,column = "mock_sql",property = "mockSql"),
            @Result(id=false,column = "replace_sql",property = "replaceSql"),
            @Result(id=false,column = "intercept_sql",property = "mockSql")
    })
    List<MockData> findAllMockData(@Param("id") int maxId);
}
